package com.tz.farmer.enums;

public enum CityEnum {

    JJQ("椒江区", "JJQ"),
    HYQ("黄岩区", "HYQ"),
    LQQ("路桥区", "LQQ"),
    LHS("临海市", "LHS"),
    WLS("温岭市", "WLS"),
    YHX("玉环市", "YHX"),
    TTX("天台县", "TTX"),
    XJX("仙居县", "XJX"),
    SMX("三门县", "SMX");

    private CityEnum(String name, String code) {
        this.name = name;
        this.code = code;
    }
    private String name;
    private String code;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    /**
     * 根据name取编码
     *
     * @param name
     * @return
     */
    public static String fromName(String name) {
        for (CityEnum u : CityEnum.values()) {
            if (u.getName().equals(name))
                return u.getCode();
        }
        return null;
    }
}
